interactIPython's interact can do some things that are awkward with straight widgets, such as generating plots. It will magically make built-in widgets from some simple settings objects.
In [11]:
from IPython.html.widgets import interact
from math import (sin, cos, tan)
from ipytangle import tangle
If you have defined an interact function, you can pull out all of the variables and put them in a tangle.
In [12]:
@interact
def interactor(fn=dict(sin=sin, cos=cos, tan=tan), x=(0, 360)):
print(fn(x))
In [13]:
trig_talk = tangle(interactor)
trig_talk